package com.dx.weichat.weichat.controller;

import com.dx.weichat.weichat.domain.User;
import com.dx.weichat.weichat.domain.WeatherInfo;
import com.dx.weichat.weichat.mapper.UserMapper;
import com.dx.weichat.weichat.mapper.WeatherInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: dx
 * @date: 2018/11/14/0014
 * @description:
 */
@RestController
@RequestMapping("/mybatis")
public class MybatisTestController {
	@Autowired
	private UserMapper userMapper;

	@Autowired
	private WeatherInfoMapper weatherInfoMapper;
	@RequestMapping("/getUserById")
	public User getUserById(@RequestParam String id){
		return userMapper.findUserById(id);
	}

	@RequestMapping("/insertWeatherInfo")
	public WeatherInfo insertWeatherInfo(){
		WeatherInfo weatherInfo = new WeatherInfo("2019/2/27","雨");
		weatherInfoMapper.insertWeatherInfo(weatherInfo);
		return weatherInfo;
	}
}
